<div id="main-content">
  <div class="container-fluid">
    <div class="row-fluid">
			<div class="span12">
				<div class="nonboxy-widget">
					<div class="widget-head">
						<h5><i class="black-icons blocks_images"></i><?=$title_table?></h5>
					</div>
					<div class="widget-content">
						<div class="widget-box">
              <?=$this->form_eksternal->form_open("", 'class=" form-horizontal well" id="formoutlet"', 
                      array("id_outlet" => $id_outlet))?>
								<fieldset>
									<div class="control-group">
										<label class="control-label">Tanggal</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_date("tanggal", date("Y-m-d"), "tanggal", "", "
                        onSelect: function(dateText) {
                          set_data();
                        },")?>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">Jumlah Service</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_input('service', "", 'id="service"')?>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">Jumlah Service + Belanja</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_input('service_belanja', "", 'id="service_belanja"')?>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">Jumlah Belanja</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_input('belanja', "", 'id="belanja"')?>
										</div>
									</div>
                  <div class="control-group">
										<label class="control-label">Rupian Service</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_input('p_service', "", 'id="p_service"')?>
										</div>
									</div>
                  <div class="control-group">
										<label class="control-label">Rupiah Service (Service + Belanja)</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_input('p_service_plus', "", 'id="p_service_plus"')?>
										</div>
									</div>
                  <div class="control-group">
                    <label class="control-label">Rupiah Belanja (Service + Belanja)</label>
										<div class="controls">
                     <?=$this->form_eksternal->form_input('p_belanja_plus', "", 'id="p_belanja_plus"')?>
                    </div>
									</div>
                  <div class="control-group">
										<label class="control-label">Rupian Belanja</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_input('p_belanja', "", 'id="p_belanja"')?>
										</div>
									</div>
                  <div class="control-group">
										<label class="control-label">Total HPP</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_input('total_hpp', "", 'id="total_hpp"')?>
                      <?=$this->form_eksternal->form_input('id_day_actifity_report', "", 'style="display: none" id="id_day_actifity_report"')?>
										</div>
									</div>
								</fieldset>
								<div class="form-actions">
									<button class="btn btn-primary" type="submit">Save changes</button>
									<button class="btn" onclick="history.go(-1);return false;">Cancel</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
  </div>
</div>
<script>
  function set_data(){
    var tanggal = $("#tanggal").val();
    $.post('<?=site_url("outlet/tambahan/get-data/".$id_outlet)?>/'+tanggal,{no:""},function(data){
      var obj = jQuery.parseJSON( data );
      $("#service").val(obj['service']);
      $("#service_belanja").val(obj['service_belanja']);
      $("#belanja").val(obj['belanja']);
      $("#p_service").val(obj['p_service']);
      $("#p_belanja_plus").val(obj['p_belanja_plus']);
      $("#p_service_plus").val(obj['p_service_plus']);
      $("#p_belanja").val(obj['p_belanja']);
      $("#total_hpp").val(obj['total_hpp']);
      $("#id_day_actifity_report").val(obj['id_day_actifity_report']);
		  console.log(obj);
    });
  }
  set_data();
</script>